(defun  sum-20 ()
  (let ((sum 0))
    (dotimes (i 19 sum)
      (setq sum (+ sum (+ 2 i))))))

(defun triangle (number-of-rows)
  (let ((total 0))
    (dotimes (number number-of-rows total)
      (setq total (+ total (1+ number))))))


(defun evenly-divisible (no-to-divide)
  (let ((no-divisible 1))
    (dotimes (i (- no-to-divide 1) no-di(visible)
      (setq no-divisible (* no-divisible (to-divide-with (1+ i))))
      (format t "for step ~D to-divide-with ~D~%" (1+ i) (to-divide-with (1+ i)))))))

(defun to-divide-with (n)
  (let ((myno n))
    (dotimes (i (- (half n) 1) myno)
      (if (= 0 (mod myno (+ 2 i)))
	  (do ((j  0 (1+ j)))
	      ((= 0 (mod myno (+ 2 i))))
	  ;;	  (print (+ 2 i))))))
	    (setq myno (/ myno (to-divide-with (+ 2 i)))))))))



(defun half (n)
  (floor (/ n 2)))

(defun factors (n)
  (let ((fact nil))
    (dotimes (i (- (half n) 1) fact)
      (setq fact (cons (+ 2 i) fact)))))

(print (apply #'lcm (loop for i from 1 to 20 collect i)))

(defun evenly-divisible (n)
  (let ((mynum  1))
       (dotimes (i (1+ n))
	 (if (not (eq (mod mynum (1+ i) ) 0 ))
	     (do ((j 1 (1+ j)))
		 ((or (= j n) (eq (mod (* mynum j) i) 0)))
	       (if (eq (mod (* mynum  j) i) 0)
;;		   (setq mynum (* mynum (1+ j)))))))))
		   (print j)))))))

